import { ElLoading } from 'element-plus'

let temp

export const loading = {
    temp: null,
    num: 0,
    show(){
        loading.num++
        temp = ElLoading.service({
            lock: true,
            text: 'Loading',
            background: 'rgba(0, 0, 0, 0.5)'
        })
    },
    close(){
        loading.num--
        if(loading.num <= 0){
            temp && temp.close()
            temp = null
            loading.num = 0
        }
    }

}

